package edu.hubu.service;

import edu.hubu.commons.ResultsJson;
import edu.hubu.dao.impl.IUserDao;
import edu.hubu.model.User;
import org.springframework.security.core.userdetails.UserDetailsService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author moonlan
 * @date 2020/10/20 下午2:27
 */
public abstract class AbstractUserService extends AbstractService<User> implements UserDetailsService {
    protected final IUserDao dao;
    public AbstractUserService(IUserDao dao) {
        super(dao);
        this.dao = dao;
    }

    public abstract ResultsJson login(String userId, String password, String  checkCode, HttpServletRequest request);

    public abstract ResultsJson  logout(HttpServletRequest request, HttpServletResponse response, String token);

    public User findByUserName(String username) {
        return dao.findByUserName(username);
    }

}
